﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class Setup : System.Web.UI.Page
{
    Connectdbnour con = new Connectdbnour();
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            String[] sup = new String[con.Countsup()];
            sup = con.selectsup();
            DropDownList6.Items.Clear();
            DropDownList6.Items.Add("");
            for (int i = 0; i < con.Countsup(); i++)
            {
                DropDownList6.Items.Add(sup[i]);
            }
        }
    }
    protected void Button1_Click(object sender, EventArgs e)
    {
        con.insertcomp(TextBox1.Text);
        Response.Redirect("Setup.aspx");
    }
    protected void Button2_Click(object sender, EventArgs e)
    {
        con.Removecompdata(DropDownList1.SelectedItem.ToString());
        Response.Redirect("Setup.aspx");
    }
    protected void Button3_Click(object sender, EventArgs e)
    {
        con.insertfind(TextBox2.Text);
        Response.Redirect("Setup.aspx");
    }
    protected void Button4_Click(object sender, EventArgs e)
    {
        con.Removefinddata(DropDownList2.SelectedItem.ToString());
        Response.Redirect("Setup.aspx");
    }
    protected void Button5_Click(object sender, EventArgs e)
    {
        con.insertdiag(TextBox3.Text);
        Response.Redirect("Setup.aspx");
    }
    protected void Button6_Click(object sender, EventArgs e)
    {
        con.Removediagdata(DropDownList3.SelectedItem.ToString());
        Response.Redirect("Setup.aspx");
    }
    protected void Button7_Click(object sender, EventArgs e)
    {
        con.insertbrand(TextBox4.Text);
        Response.Redirect("Setup.aspx");
    }
    protected void Button8_Click(object sender, EventArgs e)
    {
        con.Removebranddata(DropDownList4.SelectedItem.ToString());
        Response.Redirect("Setup.aspx");
    }
    protected void Button9_Click(object sender, EventArgs e)
    {
        con.insertcolor(TextBox5.Text);
        Response.Redirect("Setup.aspx");
    }
    protected void Button10_Click(object sender, EventArgs e)
    {
        con.Removecolordata(DropDownList5.SelectedItem.ToString());
        Response.Redirect("Setup.aspx");
    }
    protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e)
    {
        
    }

    protected void Button12_Click(object sender, EventArgs e)
    {

    }
    protected void Button11_Click(object sender, EventArgs e)
    {
        try
        {
            con.insertsup(TextBox8.Text, TextBox9.Text, Convert.ToInt32(TextBox10.Text), Convert.ToInt32(TextBox11.Text), Convert.ToInt32(TextBox12.Text), TextBox6.Text, TextBox7.Text);
        }
        catch (Exception ex)
        {

            Label1.Text = ex.Message;
        }
        
    }
    protected void Button13_Click(object sender, EventArgs e)
    {

    }
    protected void DropDownList6_SelectedIndexChanged(object sender, EventArgs e)
    {
        String[] array = new String[8];
        array = con.showsup(DropDownList6.SelectedItem.ToString());
        TextBox8.Text = array[1].ToString();
        TextBox9.Text = array[2].ToString();
        TextBox10.Text = array[3].ToString();
        TextBox11.Text = array[4].ToString();
        TextBox12.Text = array[5].ToString();
        TextBox6.Text = array[6].ToString();
        TextBox7.Text = array[7].ToString();
    }
    protected void Button14_Click(object sender, EventArgs e)
    {
        con.insertemployee(TextBox13.Text, DropDownList7.SelectedItem.ToString(), TextBox14.Text, Convert.ToInt32(TextBox15.Text), Convert.ToInt32(TextBox16.Text));
    }
}